
local 灵饰自选 = 多开数据[多开数据.当前].__UI界面.窗口层:创建我的窗口("灵饰自选",0,0,300,407)
local 当前 = 多开数据.当前
local 灵饰正常属性={}
local 灵饰附加属性={}

function 灵饰自选:初始化()
    __置窗口坐标(self)
    
end

function 灵饰自选:打开(data)
    self:置可见(true)
    self.数据 = data
	self.附加属性 = {}
    self:重置()
end

function 灵饰自选:重置()
    local item_mc = self:取名称(self.数据.名称)
	local dj = 取物品(item_mc)
	self:置图像(dj,item_mc)
	for i=1,4 do
		灵饰自选["加"..i]:置可见(true)
	end
end

function 灵饰自选:显示(x,y)
	if self.基础属性 then
		字体18:显示(x+175,y+178,self.基础属性)
	end
	for i=1,4 do
		if self.附加属性[i] then
			字体18:显示(x+100,y+163+i*35,self.附加属性[i])
		end
	end
end

function 灵饰自选:置图像(dj,mc)
	self.名称 = mc
	local nsf = require('SDL.图像')(300,407)
    if nsf:渲染开始() then
		local lssj = 取输入背景(0, 0, 140, 23)
        置窗口背景("灵饰自选",0,12,300,380,true):显示(0,0)
        取灰色背景(0,0,290,340,true):显示(5,45)
		self.道具介绍:清空()
		__res:取图像(__res:取地址("shape/dj/", dj[13])):显示(10,50)
		self.道具介绍:置文本('#Y'..mc)
		self.道具介绍:置文本('#K'..dj[1])
		字体18:取图像("主属性："):显示(100,175)
		for i=1,4 do
			字体18:取图像("属性["..i.."]"):显示(30,195+((i-1)*35))
			lssj:显示(90,195+((i-1)*35))
		end
    end
    self:置精灵(nsf:到精灵())
end


for z=1,4 do
	local 临时函数 = 灵饰自选:创建我的按钮(__res:getPNGCC(1,641,320,29,29),"加"..z,240,195+((z-1)*35))
	function 临时函数:左键弹起(x,y,msg)
		local 对话信息 = 灵饰附加属性
		local 回调处理 = function (i,选项)
			灵饰自选.附加属性[z] = 选项[i]
		end
		多开数据[当前].__UI界面.窗口层.对话栏:打开({模型="女人_万圣公主",名称="灵饰附加",对话="请选择灵饰附加的属性",选项=对话信息,回调处理=回调处理})
	end
end

local 类型选择 = 灵饰自选:创建我的按钮(__res:getPNGCC(1,641,320,29,29),"类型选择",240,150)
function 类型选择:左键弹起(x,y,msg)
	local 对话信息 = 灵饰正常属性
	local 回调处理 = function (i,选项)
		灵饰自选.基础属性 = 选项[i]
	end
	多开数据[当前].__UI界面.窗口层.对话栏:打开({模型="女人_万圣公主",名称="灵饰基础",对话="请选择灵饰基础属性",选项=对话信息,回调处理=回调处理})
end


local 关闭 = 灵饰自选:创建我的按钮(__res:getPNGCC(1,401,0,46,46),"关闭",255,0)
function 关闭:左键弹起(x,y,msg)
    灵饰自选:置可见(false)
end

local 确定 = 灵饰自选:创建我的按钮(__res:getPNGCC(1,449,28,174,35,true):置拉伸(90,30),"确定",180,340,"确定")

function 确定:左键弹起(消息,x,y)
    local 事件 = function()
		local 发送信息 = {基础={类型=灵饰自选.基础属性},附加={}}
		for i=1,4 do
			发送信息.附加[i] = {类型=灵饰自选.附加属性[i]}
		end
		发送数据(当前 or self and self.当前,3819,{幻化属性=发送信息})
		灵饰自选.基础属性 = nil
		灵饰自选.附加属性 = {}
		灵饰自选:置可见(false)
	end
	local wb = "属性一旦选定无法更改,你确定要提交么?"   
	多开数据[当前].__UI界面.窗口层.文本栏:打开(wb,285,155,390,200,事件)
end

local 道具介绍 = 灵饰自选:创建我的文本("道具介绍",130,60,160,220)

function 灵饰自选:取名称(名称)
	if  名称=="太虚渺云" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "太虚渺云"
	elseif 名称=="浮雪幻音" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "浮雪幻音"
	elseif 名称=="碧海青天" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "碧海青天"
	elseif 名称=="焰云霞珠" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "焰云霞珠"

	elseif  名称=="悦碧水" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "悦碧水"
	elseif 名称=="花映月" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "花映月"
	elseif 名称=="相思染" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "相思染"
	elseif 名称=="点星芒" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "点星芒"

	elseif 名称=="九曜光华" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "九曜光华"
	elseif 名称=="金水菩提" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "金水菩提"
	elseif 名称=="玄龙苍珀" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "玄龙苍珀"
	elseif 名称=="凤羽流苏" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "凤羽流苏"
	elseif  名称=="金麟绕" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "金麟绕"
	elseif 名称=="芙蓉戒" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "芙蓉戒"
	elseif 名称=="翡玉镯" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "翡玉镯"
	elseif 名称=="逸云佩" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "逸云佩"
	elseif 名称=="明月珰" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "明月珰"
	elseif 名称=="墨影扣" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "墨影扣"
	elseif 名称=="莲音玦" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","抗法术暴击等级","格挡值","法术防御","抗物理暴击等级"}
		return "莲音玦"
	elseif 名称=="玉蝶翩" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "玉蝶翩"
	elseif 名称=="枫华戒" then
		灵饰正常属性={"伤害","防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
	  return "枫华戒"
	elseif 名称=="翠叶环" then
		灵饰正常属性={"法术伤害","法术防御"}
		灵饰附加属性={"固定伤害","法术伤害","伤害","封印命中等级","法术暴击等级","物理暴击等级","狂暴等级","穿刺等级","法术伤害结果","治疗能力","速度"}
		return "翠叶环"
	elseif 名称=="香木镯" then
		灵饰正常属性={"封印命中等级","抵抗封印等级"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","法术防御","抗物理暴击等级"}
		return "香木镯"
	elseif 名称=="芝兰佩" then
		灵饰正常属性={"速度"}
		灵饰附加属性={"气血","气血回复效果","防御","抵抗封印等级","法术防御","抗物理暴击等级"}
		return "芝兰佩"
	end
end